<template>
  <div>
    <title-panel />
    <van-cell>
        <div class="flex-between font-bold-400 col-333333">
        <div class="m-r-10" style="width:50%"><span style="color:#FF3B30;">*</span>羊只数量</div>
        <div class="line-text-out text-right" style="width: 26%">
          {{contentObj.otherNum || ''}}
        </div>
        <van-button native-type="button" plain color="#37B5B5" @click="toView" class="addbtn" type="primary">查看</van-button>
      </div>
    </van-cell>
    <van-cell>
      <div class="flex-between  col-333333">
        <div class="m-r-10" style="width: 50%">操作环节</div>
        <div class="line-text-out text-right" style="width: 50%">
          {{ contentObj.operation || '' }}
        </div>
      </div>
    </van-cell>

    <van-cell>
      <div class="flex-between">
        <div class="col-1b1b m-r-10" style="width: 26%">操作内容</div>
      </div>
      <div class="flex-between">
        <div class="col-8686 m-r-10">
          {{ contentObj.content || "" }}
        </div>
      </div>
    </van-cell>
    <div class="m-b-10 shop">
      <div class="flex-between bottom content font-14 line-height-2">
        <div class="col-8686 text-center footerImg" @click="deleteContent" style="width: 100%">
          <img src="../../assets/img/shanchu.png" alt="" />
          删除
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import {
  Form,
  Field,
  Calendar,
  RadioGroup,
  Radio,
  Dialog,
  Toast,
  DatetimePicker,
  Picker,
  Button,
  Icon,
  Cell,
  Popup,
  Image
} from 'vant'
import dayjs from 'dayjs'
// import {
//   commonService,
//   buyProcessService,
//   standardizeService,
// } from "@/services";
import UploadImg from '@/components/uploadImg'
import TitlePanel from '@/components/titlePanel'
import { getValue, setValue, setObject ,clearValue} from '@/utils/auth'
import { postHandle, getHandle } from '@/api'
export default {
  components: {
    UploadImg,
    TitlePanel,
    [Form.name]: Form,
    [Field.name]: Field,
    [Calendar.name]: Calendar,
    [RadioGroup.name]: RadioGroup,
    [Radio.name]: Radio,
    [Picker.name]: Picker,
    [DatetimePicker.name]: DatetimePicker,
    [Button.name]: Button,
    [Icon.name]: Icon,
    [Popup.name]: Popup,
    [Toast.name]: Toast,
    [Cell.name]: Cell,
    [Dialog.Component.name]: Dialog.Component,
    [Image.name]: Image,
    [Dialog.name]: Dialog
  },
  data() {
    return {
      contentObj: {},
      otherId: getValue('otherId')
    }
  },
  created() {
      this.initialize()
  },
  mounted() {},
  methods: {
    toView(){
      setValue('seeRecordId2',this.otherId)
      this.$bridge.call('sheepSee')
    },
    getContent() {},
    goCompile() {
      clearValue('syObj')
      clearValue('syEditTag2')
      this.$bridge.call('editPregnancyConfirmation')
    },
    initialize() {
      getHandle(`/agri/api/yzbzh/otherRecord/queryDetail/${this.otherId}`).then(res => {
        this.contentObj = res.data
      })
    },
    beforeClose(action, done) {
      if (action === 'confirm') {
        setTimeout(() => {
          postHandle(
            `/agri/api/yzbzh/otherRecord/delete/${this.otherId}`
          ).then(res => {
            if (res.status == '0') {
              this.$toast(res.msg)
              done()
              this.$bridge.call('base.closePage')
            } else {
              this.$toast(res.msg)
              done()
            }
          })
        }, 1000)
      } else {
        done()
      }
    },
    deleteContent() {
      Dialog.confirm({
        title: '删除确认',
        message: '确定要删除该条记录吗？',
        confirmButtonColor:'black',
        beforeClose: this.beforeClose
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.flex-between {
  line-height: 2em;
}
::v-deep .van-cell::after {
  border-color:#EEEEEE!important;
}
::v-deep .van-cell:last-child{
  border: none!important;
}
.footerImg {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #37b5b5;
  border: none!important;
  > img {
    width: 22px;
    height: 22px;
  }
}
.shop .bottom {
  position: fixed;
  bottom: 0;
  height: 68px;
  width: 100%;
  box-sizing: border-box;
  background: #ffffff;
  padding: 8px 10px 8px 14px;
  box-shadow: 0px -2px 5px 0px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.addbtn{
    width: 50px;
    height: 24px;
    font-size: 13px;
    padding: 0;
    margin-top: 2.5px;
}
</style>
